There are train routes which take you from Tehran and other nearby cities such as Arak, Yazd and Isfahan.
By train
Qom train station
+98/(0)251/6617141
By car
By car
Driving from Tehran might be a reasonable option, however, if you're worried about driving in Iran you can reserve a private bus to take you to Qom. After all, it is much safer to travel by private buses.
By plane
By plane
The nearest and most easily accessible international airport is Tehran's Imam Khomeini International Airport IATA: IKA, ICAO: OIIE, which is due to replace the older Mehrabad International Airport IATA: THR, ICAO: OIII.